<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<body>
<script type="text/javascript" src="../js/vue-2.6.12.js"></script>
<script type="text/javascript" src="../js/vue-router-3.4.9.js"></script>

<div id="app">
    <router-link to="/show_param?username=zhangsan&age=20">点我进入组件1</router-link>
    <router-link :to="{name:'show_param',query:{username:'lisi',age:20}}">点我进入组件2</router-link>
    <router-view></router-view>
</div>
<template id="show_param">
    <div>
        页面传递过来的数据{{$route.query.username}}----{{$route.query.age}}
    </div>
</template>

<script>
    const show_param={
        template:"#show_param"
    }

    const router=new VueRouter({
        routes:[
            {name:"show_param",path:"/show_param",component:show_param}
        ]
    });
    const vm = new Vue({
        el:"#app",
        router
    })
</script>
</body>
</html>